package nc.ui.medpub.bd.hf00100503;

import nc.bs.framework.common.NCLocator;
import nc.bs.framework.exception.ComponentException;
import nc.bs.logging.Logger;
import nc.bs.uap.bd.BDRuntimeException;
import nc.itf.medpub.bd.hf00100503.IMedInvBaseService;
import nc.itf.uap.IUAPQueryBS;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;

public class MedInvBasDoc_Client {

	private static IMedInvBaseService medService;
	private static IUAPQueryBS uapQueryService;

	private static IMedInvBaseService getmedService() {
		if (medService == null) {
			try {
				medService = (IMedInvBaseService) NCLocator.getInstance()
						.lookup(IMedInvBaseService.class.getName());
			} catch (ComponentException e) {
				Logger.error(e.getMessage(), e);
				throw new BDRuntimeException("cann't locate MedInvBasdocImpl");
			}
		}
		return medService;
	}

	public static IUAPQueryBS getUapQueryService() {
		if (uapQueryService == null) {
			try {
				uapQueryService = (IUAPQueryBS) NCLocator.getInstance().lookup(
						IUAPQueryBS.class.getName());
			} catch (ComponentException e) {
				Logger.error(e.getMessage(), e);
				throw new BDRuntimeException("cann't locate MedInvBasdocImpl");
			}
		}
		return uapQueryService;
	}

	// public static void delete(MedbreeddocVO arg0) throws Exception {
	// getmedService().deleteMedbreeddocVO(arg0);
	// }
	//
	public static java.lang.String insert(AggregatedValueObject aggVO)
			throws BusinessException {
		return getmedService().insertInvBaseVO(aggVO);
	}
	//
	// public static void update(MedbreeddocVO arg0) throws BusinessException {
	// getmedService().updateMedbreeddocVO(arg0);
	// }
	//
	// public static MedbreeddocVO[] queryAll(java.lang.String arg0) throws
	// BusinessException {
	// return getmedService().queryMedbreeddoc(arg0);
	// }
	//	
	// public static MedCataTypeVO[] queryCataTypeByCorpPk(String pk_corp){
	//		
	// MedCataTypeVO[] cataTypeVOs = null;
	// String where = "pk_corp='" + pk_corp + "' or pk_corp='0001' order by
	// medcatatypecode";
	// try {
	// Collection c = getUapQueryService().retrieveByClause(MedCataTypeVO.class,
	// where);
	// if (c != null && c.size() > 0) {
	// cataTypeVOs = (MedCataTypeVO[]) c.toArray(new MedCataTypeVO[c.size()]);
	// }
	// } catch (BusinessBusinessException e) {
	// throw new BusinessRuntimeBusinessException(e.getMessage());
	// }
	// return cataTypeVOs;
	// }

}
